package com.gzh.teaching.model.vo;

import com.gzh.core.dao.po.QuestionEntity;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;

/**
 * @Author guanzh
 * @Date 2022/1/24 17:09
 * @Description
 */
@Setter
@Getter
@ToString
@NoArgsConstructor
public class JudgeVo {
    private String name;

    private String checked;

    private String analyze;

    public JudgeVo(QuestionEntity t) {
        this.name = t.getQuestionName();
        this.checked = t.getAnswer();
        this.analyze = t.getAnalyzeText();
    }

    public QuestionEntity toEntity(Integer finalWorkId){
        QuestionEntity questionEntity = new QuestionEntity();
        questionEntity.setQuestionName(this.name);
        questionEntity.setAnswer(this.checked.equals("true") ? "1" : "0");
        questionEntity.setAnalyzeText(this.analyze);
        questionEntity.setQuestionType(4);
        questionEntity.setWorkId(finalWorkId);
        return questionEntity;
    }
}
